﻿using System;

namespace InstallWSPBuilderForms
{
    enum VisualStudioVersion
    {
        //vs2003 = 7,
        vs2005 = 8,
        vs2008 = 9,
        //vs2010 = 10,
    }

    enum Bitness
    {
        x32 = 32,
        x64 = 64
    }

    internal static class EnumHelpers
    {
        #region VisualStudioVersion Enum
        internal static string InternalVersionString(this VisualStudioVersion vsVersionEnum)
        {
            System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US");
            return ((double)(int)vsVersionEnum).ToString("0.0", ci.NumberFormat);
        }

        internal static string ConvertVsEnumToVsStringVersion(VisualStudioVersion vsVersionEnum)
        {
            return vsVersionEnum.ToString().Substring(2);
        }

        internal static VisualStudioVersion ConvertVsStringToVsEnumVersion(string vsVersion)
        {
            return (VisualStudioVersion)Enum.Parse(typeof(VisualStudioVersion), vsVersion, false);
        }

        internal static string GetFullVisualStudioVersion(this VisualStudioVersion vsVesrionEnum)
        {
            return "Visual Studio " + ConvertVsEnumToVsStringVersion(vsVesrionEnum);
        } 
        #endregion

        #region Bitness Enum
        internal static string FormatedBitnessString(this Bitness bitEnum)
        {
            return bitEnum.ToString().Substring(1) + "-bit";
        }

        internal static Bitness ConvertBitTypeStringToBitEnum(string bitTypeString)
        {
            return (Bitness)Enum.Parse(typeof(Bitness), bitTypeString, false);
        }
        #endregion
    }
}
